package tech.aistar.service;


import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import tech.aistar.entity.Com;

import java.util.Date;

/**
 * Created by Administrator on 2019/10/7.
 */
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class ComTest {
    @Autowired
    private IComService comService;
    @Autowired
    private IComVoService comVoService;

    @Autowired
    private IPointService pointService;
    @Test
    public void test1(){
        comService.findAllComment();
        System.err.println(comService.findAllComment());
    }

    //评论
    @Test
    public void testaddOne(){
        Com com = new Com();
        com.setFloor(2);//楼层
        com.setPostId(1);
        com.setUserId(1);
        com.setContent("用户一的评论");
        com.setCtime(new Date());
        com.setPointNum(6186161);
        com.setFlag(1);
        comService.saveComment(com);
    }
    //回复
    @Test
    public void testaddTwo(){
        Com com = new Com();
        com.setFloor(2);
        com.setPostId(1);
        com.setUserId(3);
        com.setToUserId(1);
        com.setContent("用户三对用户一的回复");
        com.setCtime(new Date());
        com.setPointNum(6186161);
        com.setFlag(2);
        comService.saveComment(com);
    }
    @Test
    public void test23(){
        comVoService.findAllByPostId(2);
        System.err.println(comVoService.findAllByPostId(2));
    }

    @Test
    public void test3(){
        comService.findAllComNum();
        System.err.println(comService.findAllComNum());
    }
    @Test
    public void test4(){
        pointService.addPosts(1,1);
//        System.out.println(pointService.addPosts(1,1));
    }



}
